<template>
  <div class="app-container">
    <px-form ref="queryRef" class="custom-form-ui" :model="queryParams" :inline="true" label-width="90px">
      <!-- <px-form-item label="所属厂区">
        <px-select v-model="queryParams.level" placeholder="请选择" clearable style="width: 240px" filterable>
          <px-option v-for="dict in liquidList" :key="dict.id" :label="dict.name" :value="dict.name" />
        </px-select>
      </px-form-item> -->
      <px-form-item label="填报模板">
        <!-- <px-input v-model="queryParams.templateName" placeholder="请选择" clearable /> -->
        <px-select v-model="queryParams.templateId" placeholder="请选择" clearable style="width: 240px" filterable>
          <px-option v-for="dict in templateList" :key="dict.id" :label="dict.name" :value="dict.id" />
        </px-select>
      </px-form-item>
      <px-form-item label="时间维度" style="width: 160px !important">
        <px-select v-model="queryParams.dimension" placeholder="请选择" style="width: 90px" filterable @change="setdimension">
          <px-option v-for="dict in dimensionList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemValue" />
        </px-select>
      </px-form-item>
      <px-form-item v-if="queryParams.dimension == 'M' || queryParams.dimension == ''" label="核算范围">
        <px-date-picker
          v-model="dateRange"
          type="monthrange"
          format="YYYY-MM"
          :disabled-date="disabledDate"
          value-format="YYYY-MM-DD"
          placeholder="请选择"
        />
      </px-form-item>
      <px-form-item v-if="queryParams.dimension == 'Q'" label="核算范围">
        <pxQuarter v-model="quarteDate" style="width: 210px" @change="quarterChange" />
      </px-form-item>
      <px-form-item v-if="queryParams.dimension == 'Y'" label="核算范围">
        <!-- <px-date-picker v-model="queryParams.Time" type="year" placeholder="请选择" /> -->
        <yearPicker :labelWidth="0" labelText="" :disabledYear="2023" :initYear="dateValue" @updateTimeRange="updateStatisticYear" />
      </px-form-item>
      <px-button style="margin-top: -17px" type="primary" icon="" @click="handleQuery('search')">搜索</px-button>
      <px-button style="margin-top: -17px" icon="" @click="resetQuery">重置</px-button>
    </px-form>
    <px-row :gutter="10" class="mb8">
      <px-col :span="1.5">
        <px-button v-has="'ALL_DOUBLE_CARBON_EMISSIONREPORT_ADD'" type="primary" icon="" @click="handleAdd">新增</px-button>
      </px-col>
    </px-row>
    <px-table v-loading="loading" :data="typeList" height="calc(100vh - 319px)" show-overflow-tooltip border>
      <px-table-column label="序号" fixed="left" type="index" width="70">
        <template #default="{ $index }">
          {{ $index + 1 + (queryParams.pageNum - 1) * queryParams.pageSize }}
        </template>
      </px-table-column>

      <px-table-column label="报告名称" prop="hazardCharacteristics">
        <template #default="scope">
          <span>{{ scope.row.name }}</span>
        </template>
      </px-table-column>

      <!-- <px-table-column label="厂区" prop="hazardCharacteristics">
        <template #default="scope">
          <span>{{ scope.row.level }}</span>
        </template>
      </px-table-column> -->
      <px-table-column label="时间维度" prop="dimension">
        <template #default="scope">
          <span v-if="scope.row.dimension == 'M'">月度</span>
          <span v-if="scope.row.dimension == 'Q'">季度</span>
          <span v-if="scope.row.dimension == 'Y'">年度</span>
        </template>
      </px-table-column>
      <px-table-column label="核算范围" prop="hazardCharacteristics">
        <template #default="scope">
          <span>{{ scope.row.range }}</span>
        </template>
      </px-table-column>
      <px-table-column label="填报模板" prop="hazardCharacteristics">
        <template #default="scope">
          <span>{{ scope.row.templateName }}</span>
        </template>
      </px-table-column>
      <px-table-column label="创建人" prop="receiveCompany">
        <template #default="scope">
          <span>{{ scope.row.createByName }}</span>
        </template>
      </px-table-column>
      <px-table-column label="创建时间" prop="outboundTime">
        <template #default="scope">
          <span>{{ scope.row.createTime }}</span>
        </template>
      </px-table-column>
      <px-table-column fixed="right" label="操作" align="center" width="140">
        <template #default="scope">
          <px-button v-has="'ALL_DOUBLE_CARBON_EMISSIONREPORT_VIEW'" link type="primary" @click="handleDetail(scope.row)">
            <px-tooltip class="box-item" content="预览" placement="top">
              <px-icon>
                <View />
              </px-icon> </px-tooltip
          ></px-button>
          <px-button
            v-if="scope.row.status != 'INVALID'"
            v-has="'ALL_DOUBLE_CARBON_EMISSIONREPORT_DOWNLOAD'"
            link
            type="primary"
            @click="handleDown(scope.row.id)"
          >
            <px-tooltip class="box-item" content="下载" placement="top">
              <px-icon>
                <Download />
              </px-icon> </px-tooltip
          ></px-button>
          <px-button
            v-if="scope.row.status != 'INVALID'"
            v-has="'ALL_DOUBLE_CARBON_EMISSIONREPORT_DEL'"
            link
            type="danger"
            @click="handleDelete(scope.row)"
            ><px-tooltip class="box-item" content="删除" placement="top">
              <px-icon>
                <Delete />
              </px-icon> </px-tooltip
          ></px-button>
        </template>
      </px-table-column>
      <template #empty>
        <px-empty :image-size="150" />
      </template>
    </px-table>

    <pagination
      v-show="total > 0"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      style="margin-bottom: -10px"
      :total="total"
      @pagination="getList"
    />
    <px-dialog v-model="addtemplate" width="455" :close-on-click-modal="false" title="生成报告" align-center>
      <px-form ref="detailruleFormRef" :model="addForm" :rules="rules2" :inline="true" label-width="95px">
        <px-row>
          <px-col :span="24">
            <px-form-item label="时间维度" prop="dimension">
              <px-select v-model="addForm.dimension" placeholder="请选择" style="width: 290px" filterable @change="setdimension2">
                <px-option v-for="dict in dimensionList" :key="dict.itemValue" :label="dict.itemName" :value="dict.itemValue" />
              </px-select>
            </px-form-item>
          </px-col>
        </px-row>
        <px-row>
          <px-col :span="24">
            <px-form-item v-if="addForm.dimension == 'M'" label="核算范围" prop="dateRange2">
              <px-date-picker
                v-model="addForm.dateRange2"
                type="monthrange"
                style="width: 290px"
                format="YYYY-MM"
                value-format="YYYY-MM-DD"
                placeholder="请选择"
              />
            </px-form-item>
            <px-form-item v-if="addForm.dimension == 'Q'" label="核算范围" prop="dateRange2">
              <pxQuarter v-model="quarteDate" style="width: 290px" @change="quarterChange2" />
            </px-form-item>
            <px-form-item v-if="addForm.dimension == 'Y'" label="核算范围" prop="dateRange2">
              <!-- <px-date-picker v-model="queryParams.Time" type="year" placeholder="请选择" /> -->
              <yearPicker
                class="yearinput"
                style="width: 290px; color: balck; border: 1px solid #ccc"
                :labelWidth="0"
                :disabledYear="2023"
                labelText=""
                :initYear="dateValue"
                @updateTimeRange="updateStatisticYear2"
              />
            </px-form-item>
          </px-col>
        </px-row>
        <!-- <px-row>
          <px-col :span="24">
            <px-form-item label="所属厂区" :maxlength="50" prop="level">
              <px-select v-model="addForm.level" placeholder="请选择" clearable style="width: 290px" filterable>
                <px-option v-for="dict in liquidList" :key="dict.id" :label="dict.name" :value="dict.name" />
              </px-select>
            </px-form-item>
          </px-col>
        </px-row> -->
        <px-row>
          <px-col :span="24">
            <px-form-item label="填报模板" :maxlength="50" prop="templateId">
              <px-select v-model="addForm.templateId" placeholder="请选择" clearable style="width: 290px" filterable>
                <px-option v-for="dict in templateList" :key="dict.id" :label="dict.name" :value="dict.id" />
              </px-select>
            </px-form-item>
          </px-col>
        </px-row>
        <!-- <px-row>
          <px-col :span="24">
            <px-form-item label="报告名称" :maxlength="50" prop="name">
              <px-input v-model="addForm.name" style="width: 290px" placeholder="请输入" clearable />
            </px-form-item>
          </px-col>
        </px-row> -->
      </px-form>
      <template #footer>
        <span class="dialog-footer">
          <px-button @click="addtemplate = false">取消</px-button>
          <px-button type="primary" @click="addReport(detailruleFormRef)"> 确定 </px-button>
        </span>
      </template>
    </px-dialog>
    <px-dialog v-model="viewflg" width="800" :close-on-click-modal="false" title="报告预览" align-center>
      <div v-if="viewdata != null">
        <px-descriptions class="margin-top" title="报告信息" :column="2" border>
          <!-- <px-descriptions-item>
            <template #label>
              <div class="cell-item">厂区:</div>
            </template>
            {{ viewdata.level }}
          </px-descriptions-item> -->
          <px-descriptions-item>
            <template #label>
              <div class="cell-item">时间维度:</div>
            </template>
            <span v-if="viewdata.dimension == 'M'">月度</span>
            <span v-if="viewdata.dimension == 'Q'">季度</span>
            <span v-if="viewdata.dimension == 'Y'">年度</span>
          </px-descriptions-item>
          <px-descriptions-item>
            <template #label>
              <div class="cell-item">核算范围:</div>
            </template>
            {{ viewdata.range }}
            <!-- {{ viewdata.startDate ? viewdata.startDate.slice(0, 10) : "" }}-{{ viewdata.endDate ? viewdata.endDate.slice(0, 10) : "" }} -->
          </px-descriptions-item>
          <px-descriptions-item>
            <template #label>
              <div class="cell-item">核算模板:</div>
            </template>
            {{ viewdata.templateName }}
          </px-descriptions-item>
          <px-descriptions-item>
            <template #label>
              <div class="cell-item">填报人:</div>
            </template>
            {{ viewdata.createByName }}
          </px-descriptions-item>
          <px-descriptions-item>
            <template #label>
              <div class="cell-item">填报时间:</div>
            </template>
            {{ viewdata.createTime }}
          </px-descriptions-item>
        </px-descriptions>
        <div v-for="(item, index) in viewdata.facility" :key="index">
          <px-descriptions style="margin-top: 16px" :title="item.emissionCategory" :column="2" border />
          <px-table :data="item.activity" border show-overflow-tooltip>
            <px-table-column type="index" label="排行" width="60" />
            <px-table-column label="设施/活动" prop="facilityName">
              <template #default="scope">
                <span>{{ scope.row.facilityName }}</span>
              </template>
            </px-table-column>
            <px-table-column label="活动数据" prop="activityLevel">
              <template #default="scope">
                <span>{{ scope.row.activityLevel ? scope.row.activityLevel : "-" }}</span>
              </template>
            </px-table-column>
            <px-table-column label="单位" prop="unit">
              <template #default="scope">
                <span>{{ scope.row.unit ? scope.row.unit : "-" }}</span>
              </template>
            </px-table-column>
            <px-table-column label="排放量（tCO₂e）" prop="carbonEmission">
              <template #default="scope">
                <span>{{ scope.row.carbonEmission }}</span>
              </template>
            </px-table-column>
          </px-table>
        </div>
        <px-descriptions style="margin-top: 16px" title="不同类别温室气体排放量" :column="2" border />
        <px-table :data="viewdata.category" border show-overflow-tooltip>
          <px-table-column type="index" label="排行" width="60" />
          <px-table-column label="类别" prop="emissionCategory">
            <template #default="scope">
              <span>{{ scope.row.emissionCategory }}</span>
            </template>
          </px-table-column>
          <px-table-column label="碳排放（tCO₂e）" prop="carbonEmission">
            <template #default="scope">
              <span>{{ scope.row.carbonEmission }}</span>
            </template>
          </px-table-column>
          <px-table-column label="占比（%）" prop="ratio">
            <template #default="scope">
              <span>{{ scope.row.ratio ? scope.row.ratio : "-" }}%</span>
            </template>
          </px-table-column>
        </px-table>
      </div>
      <div v-else>
        <px-empty :image-size="100" />
      </div>
    </px-dialog>
    <!-- <VueOfficeExcel src="/public/models/工具台账.xlsx" style="width: 100%; height: 200px" /> -->
  </div>
</template>

<script setup lang="ts">
import { getCurrentInstance, ref, toRefs, reactive, onMounted } from "vue";
// import VueOfficeExcel from "@vue-office/excel";
import { PxMessage, PxMessageBox } from "px-ui";
import pxQuarter from "./components/pxQuarter.vue";
import yearPicker from "@/views/common/energy/components/yearPicker.vue";
import { emissionReportsave, emissionReportquery } from "@/api/doubleCarbonManage/dataReport";
import { accountingReporttemplateList, emissionReportdelete, emissionReportpreview } from "@/api/doubleCarbonManage/accountingManage";
import { queryDictData } from "@/api/common";
const dateValue = ref<any>({ startYear: new Date().getFullYear() - 2, endYear: new Date().getFullYear() });
const { proxy }: any = getCurrentInstance();
const addtemplate = ref(false);
const viewflg = ref(false);
const detailruleFormRef = ref();
const disabledDate = time => {
  return time.getFullYear() < 2023;
};
const data = reactive({
  queryParams: {
    orderByColumn: "",
    isAsc: "",
    level: "",
    templateName: "",
    templateId: "",
    dimension: "",
    startDate: "",
    endDate: "",
    orderBy: "",
    pageNum: 1,
    pageSize: 20
  },
  dimensionList: [
    {
      itemName: "月度",
      itemValue: "M"
    },
    {
      itemName: "季度",
      itemValue: "Q"
    },
    {
      itemName: "年度",
      itemValue: "Y"
    }
  ],
  liquidList: [],
  loading: false,
  dateRange: [],
  dateRange2: [],
  typeList: [],
  total: 0,
  buttonTitle: "",
  addVisible: false,
  equipdata: {
    outboundNumber: "",
    wasteName: "",
    wasteCode: "",
    wasteType: "",
    hazardCharacteristics: "",
    dictWasteCode: "",
    outboundTime: "",
    receiveCompany: "",
    wasteCompany: "",
    temporaryStorageDepartment: "",
    updateTime: "",
    content: []
  },
  rules2: {
    dateRange2: [{ required: true, message: "不能为空", trigger: "change" }],
    level: [{ required: true, message: "不能为空", trigger: "change" }],
    templateId: [{ required: true, message: "不能为空", trigger: "change" }],
    name: [{ required: true, message: "不能为空", trigger: "blur" }],
    dimension: [{ required: true, message: "不能为空", trigger: "change" }]
  },
  addForm: {
    level: "",
    name: "",
    startDate: "",
    endDate: "",
    dimension: "M",
    templateId: "",
    dateRange2: [],
    quarteDate: ""
  },
  templateList: [],
  viewdata: {
    level: "",
    dimension: null,
    startDate: null,
    endDate: null,
    templateName: "",
    createTime: "",
    createByName: "",
    facility: [],
    category: []
  },
  quarteDate: ""
});
const {
  quarteDate,
  dimensionList,
  viewdata,
  queryParams,
  templateList,
  addForm,
  rules2,
  liquidList,
  loading,
  dateRange,
  dateRange2,
  typeList,
  total,
  buttonTitle,
  addVisible,
  equipdata
} = toRefs(data);
const getsixmonth = () => {
  const date = new Date();
  let SixMon = new Date(date);
  SixMon.setMonth(SixMon.getMonth() - 6);
  console.log(SixMon.toISOString().split("T")[0].slice(0, -3));
  return SixMon.toISOString().split("T")[0].slice(0, -3);
};
const getdate = () => {
  const date = new Date();
  return date.toISOString().split("T")[0].slice(0, -3);
};
const updateStatisticYear: any = (startYear: number, endYear: number) => {
  console.log("选中年份", startYear, endYear);
  queryParams.value.startDate = `${startYear}-01-01 00:00:00`;
  queryParams.value.endDate = `${endYear}-12-31 23:59:59`;
};
const updateStatisticYear2: any = (startYear: number, endYear: number) => {
  console.log("选中年份", startYear, endYear);
  addForm.value.startDate = `${startYear}-01-01 00:00:00`;
  addForm.value.endDate = `${endYear}-12-31 23:59:59`;
  addForm.value.dateRange2 = `${startYear}-01-01 - ${endYear}-12-31`;
};
const quarterChange2 = val => {
  console.log(val.split("-")[1]);
  if (val.split("-")[1] == "第1季度") {
    addForm.value.startDate = `${val.split("-")[0]}-01-01 00:00:00`;
    addForm.value.endDate = `${val.split("-")[0]}-03-31 23:59:59`;
    addForm.value.dateRange2 = `${val.split("-")[0]}-01-01~${val.split("-")[0]}-03-31`;
  }
  if (val.split("-")[1] == "第2季度") {
    addForm.value.startDate = `${val.split("-")[0]}-04-01 00:00:00`;
    addForm.value.endDate = `${val.split("-")[0]}-06-30 23:59:59`;

    addForm.value.dateRange2 = `${val.split("-")[0]}-01-01~${val.split("-")[0]}-03-31`;
  }
  if (val.split("-")[1] == "第3季度") {
    addForm.value.startDate = `${val.split("-")[0]}-07-01 00:00:00`;
    addForm.value.endDate = `${val.split("-")[0]}-09-30 23:59:59`;

    addForm.value.dateRange2 = `${val.split("-")[0]}-01-01~${val.split("-")[0]}-03-31`;
  }
  if (val.split("-")[1] == "第4季度") {
    addForm.value.startDate = `${val.split("-")[0]}-10-01 00:00:00`;
    addForm.value.endDate = `${val.split("-")[0]}-12-31 23:59:59`;

    addForm.value.dateRange2 = `${val.split("-")[0]}-01-01~${val.split("-")[0]}-03-31`;
  }
};
onMounted(() => {
  if (queryParams.value.dimension == "Y") {
    queryParams.value.startDate = `${new Date().getFullYear() - 4}-01-01 00:00:00`;
    queryParams.value.endDate = `${new Date().getFullYear()}-12-31 23:59:59`;
    // getList();
  } else if (queryParams.value.dimension == "M") {
    queryParams.value.startDate = `${new Date().getFullYear()}-01-01 00:00:00`;
    queryParams.value.endDate = `${new Date().getFullYear()}-12-31 23:59:59`;
    dateRange.value = [`${getsixmonth()}`, `${getdate()}`];
  }
  queryDictData({ typeCode: "factoryArea" }).then(res => {
    liquidList.value = res;
  });
  //核算模板下拉框
  accountingReporttemplateList({}).then(res => {
    templateList.value = res;
  });
  if (localStorage.getItem("facList")) {
    let faclist = JSON.parse(localStorage.getItem("facList"));
    if (faclist.length == 1) {
      queryParams.value.level = faclist[0].name;
      getList();
    } else if (faclist.length == 2) {
      queryParams.value.level = faclist.filter(item => item.code == localStorage.getItem("facCode"))[0].name;
      getList();
    }
  }
});
const addReport = async (formEl: any) => {
  if (!formEl) return;
  await formEl.validate(async valid => {
    if (valid) {
      let params = {
        level: addForm.value.level,
        startDate: addForm.value.startDate,
        endDate: addForm.value.endDate,
        templateId: addForm.value.templateId,
        dimension: addForm.value.dimension
      };
      if (addForm.value.dimension == "M") {
        params.startDate = `${addForm.value.dateRange2[0]} 00:00:00`;
        params.endDate = `${addForm.value.dateRange2[1]} 23:59:59`;
      }
      emissionReportsave(params).then(res => {
        console.log(res);
        addtemplate.value = false;
        getList();
      });
    }
  });
};
const quarterChange = val => {
  console.log(val.split("-")[1]);
  if (val.split("-")[1] == "第1季度") {
    queryParams.value.startDate = `${val.split("-")[0]}-01-01 00:00:00`;
    queryParams.value.endDate = `${val.split("-")[0]}-03-31 23:59:59`;
    getList();
  }
  if (val.split("-")[1] == "第2季度") {
    queryParams.value.startDate = `${val.split("-")[0]}-04-01 00:00:00`;
    queryParams.value.endDate = `${val.split("-")[0]}-06-30 23:59:59`;
    getList();
  }
  if (val.split("-")[1] == "第3季度") {
    queryParams.value.startDate = `${val.split("-")[0]}-07-01 00:00:00`;
    queryParams.value.endDate = `${val.split("-")[0]}-09-30 23:59:59`;
    getList();
  }
  if (val.split("-")[1] == "第4季度") {
    queryParams.value.startDate = `${val.split("-")[0]}-10-01 00:00:00`;
    queryParams.value.endDate = `${val.split("-")[0]}-12-31 23:59:59`;
    getList();
  }
};
const setdimension2 = val => {
  addForm.value.startDate = "";
  addForm.value.endDate = "";
  addForm.value.dateRange2 = [];
  if (val == "Y") {
    addForm.value.startDate = `${dateValue.value.startYear}-01-01 00:00:00`;
    addForm.value.endDate = `${dateValue.value.endYear}-12-31 23:59:59`;
    addForm.value.dateRange2 = [`${dateValue.value.startYear}-01-01`, `${dateValue.value.endYear}-12-31`];
  }
};
const setdimension = val => {
  console.log(val);
  if (val == "Y") {
    queryParams.value.startDate = `${dateValue.value.startYear}-01-01 00:00:00`;
    queryParams.value.endDate = `${dateValue.value.endYear}-12-31 23:59:59`;
  }
  // getList();
};
function handleQuery(type) {
  if (type == "search") {
    queryParams.value.pageNum = 1;
  }
  getList();
}
function getList() {
  loading.value = true;
  if (queryParams.value.dimension == "M") {
    console.log(dateRange.value);
    if (dateRange.value.length > 0) {
      queryParams.value.startDate = `${dateRange.value[0]} 00:00:00`;
      queryParams.value.endDate = `${dateRange.value[1]} 23:59:59`;
    } else {
      queryParams.value.startDate = "";
      queryParams.value.endDate = "";
    }
  }
  if (queryParams.value.dimension != "" && queryParams.value.startDate == "") {
    PxMessage({
      message: "请选择时间后搜索",
      type: "error"
    });
    loading.value = false;
  } else {
    emissionReportquery(queryParams.value).then((response: any) => {
      typeList.value = response.data;
      total.value = response.total;
      loading.value = false;
    });
  }
}

function resetQuery() {
  queryParams.value = {
    pageNum: queryParams.value.pageNum,
    pageSize: queryParams.value.pageSize,
    orderByColumn: "",
    isAsc: "",
    level: "",
    templateName: "",
    templateId: "",
    startDate: "",
    endDate: "",
    dimension: "",
    orderBy: ""
  };
  dateRange.value = [];
  quarteDate.value = [];
  // dateRange.value = [`${new Date().getFullYear()}-${getsixmonth()}-01`, `${new Date().getFullYear()}-${new Date().getMonth() + 1}-01`];
  if (localStorage.getItem("facList")) {
    let faclist = JSON.parse(localStorage.getItem("facList"));
    if (faclist.length == 1) {
      queryParams.value.level = faclist[0].name;
    } else if (faclist.length == 2) {
      queryParams.value.level = faclist.filter(item => item.code == localStorage.getItem("facCode"))[0].name;
    }
  }
  handleQuery("reset");
}
function handleAdd() {
  buttonTitle.value = "新增";
  addtemplate.value = true;
  addForm.value = {
    level: "",
    name: "",
    startDate: "",
    endDate: "",
    templateId: "",
    dimension: "M",
    dateRange2: []
  };
  if (localStorage.getItem("facList")) {
    let faclist = JSON.parse(localStorage.getItem("facList"));
    if (faclist.length == 1) {
      addForm.value.level = faclist[0].name;
    } else if (faclist.length == 2) {
      addForm.value.level = faclist.filter(item => item.code == localStorage.getItem("facCode"))[0].name;
    }
  }
  detailruleFormRef.value.resetFields();
  dateRange2.value = [];
}

const handleDetail = row => {
  viewflg.value = true;
  emissionReportpreview({
    id: row.id
  })
    .then(res => {
      viewdata.value = res;
    })
    .catch(() => {
      viewflg.value = false;
    });
  // detailVisible.value = true;
  // const data = await queryDetailpull({ id: val });
  // //console.log(data);
  // equipopen.value = true;
  // // equipopenDetail.value = true;
  // fromdisable.value = true;
  // equipdata.value = data;
  //console.log(equipdata);
};
/** 导出按钮操作 */
const handleDown = async val => {
  proxy.download("post", "/energy/emissionReport/download", { id: val }, "碳排放报告.xlsx");
};
const handleDelete = row => {
  PxMessageBox.confirm("是否确认删除？", "温馨提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    confirmButtonClass: "px-button--danger",
    type: "warning",
    draggable: true
  })
    .then(async () => {
      const data = await emissionReportdelete({ id: row.id });
      PxMessage({
        message: "删除成功",
        type: "success"
      });
      getList();
    })
    .catch(() => {});
};
</script>
<style lang="scss" scoped>
:deep(.yearinput) {
  ._inner {
    color: black !important;
  }

  .disabled {
    a {
      color: #cccccc6e !important;
    }
  }

  a {
    color: black !important;
  }
}

.yearPicker .floatPanel .panelContent .disabled {
  color: white !important;
}
</style>
